import axiosServer from "@/utils/request";

/**
 * 提现申请分页查询
 * @param {*} userId 
 * @param {*} username 
 * @param {*} name 真实姓名
 * @param {*} phone 
 * @param {*} type  0待审核、1通过审核、-1驳回
 * @param {*} grants  0待发放、1已发放
 * @param {*} page 
 * @param {*} limit
 * @returns 
 */
export const getCommissionWithdrawal = (userId, username, name, phone, type, grants, page, limit) => {
    return axiosServer({
        method: "get",
        url: "/commissionWithdrawal/listData",
        params: {
            userId, username, name, phone, type, grants, page, limit
        }
    });
};
/**
 * 提现申请发放
 * @param {*} formData id  photoUrl支付成功图片
 * @returns 
 */
export const updateGrant = (formData) => {
    return axiosServer({
        method: "post",
        url: "/commissionWithdrawal/updateGrant",
        data: formData
    });
};

/**
 * 提现申请审核
 * @param {*} id 
 * @param {*} type 0待审核、1通过审核、-1驳回、-2主动撤回
 * @returns 
 */
export const updateType = (id, type) => {
    return axiosServer({
        method: "post",
        url: "/commissionWithdrawal/updateType",
        params: {
            id, type
        }
    });
};
/**
 * 用户邀请提现资金明细分页查询
 * @param {*} userId  用户id
 * @param {*} username 
 * @param {*} page 
 * @param {*} limit 
 * @returns 
 */
export const commissionMoneyLog = (userId, username, page, limit) => {
    return axiosServer({
        method: "get",
        url: "/commissionMoneyLog/listData",
        params: {
            userId, username, page, limit
        }
    });
};
/**
 * 提现余额账户分页查询
 * @param {*} userId 
 * @param {*} username 
 * @param {*} page 
 * @param {*} limit 
 * @returns 
 */
export const commissionMoney = (userId, username, page, limit) => {
    return axiosServer({
        method: "get",
        url: "/commissionMoney/listData",
        params: {
            userId, username, page, limit
        }
    });
};
/**
 * 提现额度刷新
 * @returns 
 */
export const refresh = () => {
    return axiosServer({
        method: "get",
        url: "/commissionControl/refresh",
    });
};
/**
 * 提现设置查询（前后台）
 * @returns 
 */
export const commissionControl = () => {
    return axiosServer({
        method: "get",
        url: "/commissionControl/find",
    });
};
/**
 * 提现设置修改
 * @param {*} numberLimit  提现限制、最低多少
 * @param {*} addMoney 每邀请一个人+多少钱
 * @param {*} residueQuota 固定额度
 * @param {*} quota 剩余额度
 * @param {*} note 规则
 * @returns 
 */
export const commissionControlUpdate = (numberLimit, addMoney, residueQuota, quota, note, magnification, cashExchange) => {
    return axiosServer({
        method: "post",
        url: "/commissionControl/update",
        data: {
            numberLimit, addMoney, residueQuota, quota, note, magnification, cashExchange
        }
    });
};
/**
 * 被邀请用户成就分页查询(后台)
 * @param userId 用户id
 * @param username 账号
 * @param type 0待审核、1通过审核、-1驳回
 * @param inviter 邀请人id
 * @param page
 * @param limit
 * @returns {*}
 */
export const commissionAsk = (userId, username, type, inviter, page, limit) => {
    return axiosServer({
        method: "get",
        url: "/commissionAsk/listData",
        params: {
            userId, username, type, inviter, page, limit
        }
    });
};

/**
 * 绑定送积分成就达成审核
 * @param id
 * @param type
 * @returns {*}
 */
export const commissionAskUpdateType = (id, type) => {
    return axiosServer({
        method: "post",
        url: "/commissionAsk/updateType",
        params: {
            id, type
        }
    });
};